function sum(){
    debugger
    if(document.getElementById('dangdang1').checked && document.getElementById('dangdang2').checked){
        let sum1 =document.getElementById('numberSum1').innerText;
        sum1 = sum1.substring(1,sum1.length);
        let sum2 = document.getElementById('numberSum2').innerText;
        sum2 = sum2.substring(1,sum2.length);
        let sumZong = eval(sum1+'+'+sum2);
        document.getElementById('sum').innerText ='￥'+sumZong.toFixed(2) ;
        document.getElementById('goods').innerText = '2'
    }
    else if(document.getElementById('dangdang1').checked && document.getElementById('dangdang2').checked == false){
        let sum1 =document.getElementById('numberSum1').innerText;
        sum1 = sum1.substring(1,sum1.length);
        document.getElementById('sum').innerText ='￥'+sum1 ;
        document.getElementById('goods').innerText = '1'
    }
    else if(document.getElementById('dangdang1').checked == false && document.getElementById('dangdang2').checked){
        let sum2 = document.getElementById('numberSum2').innerText;
        sum2 = sum2.substring(1,sum2.length);
        document.getElementById('sum').innerText ='￥'+sum2 ;
        document.getElementById('goods').innerText = '1'
    }
    else{
        document.getElementById('sum').innerText = '￥0.00'
        document.getElementById('goods').innerText = '0'
    }
}
function number(id,numberSum,price){
    let num = document.getElementById(id).value;
    document.getElementById(numberSum).innerText = '￥'+(num*parseFloat(price)).toFixed(2);
    this.sum();
}
function jia(id,numberSum,price){
    let num = document.getElementById(id).value;
    num=parseInt(num)+1;
    document.getElementById(id).value =num;
    this.number(id,numberSum,price);
}
function jian(id,numberSum,price){
    let num = document.getElementById(id).value;
    num=parseInt(num)-1;
    document.getElementById(id).value =num;
    this.number(id,numberSum,price);
}
function xuan(quanxuan){
    if(document.getElementById(quanxuan).checked){
        document.getElementById('quanxuan1').checked = true;
        document.getElementById('quanxuan2').checked = true;
        document.getElementById('dangdang').checked = true;
        document.getElementById('dangdang1').checked = true;
        document.getElementById('dangdang2').checked = true;
        sum();
    }else{
        document.getElementById('quanxuan1').checked = false;
        document.getElementById('quanxuan2').checked = false;
        document.getElementById('dangdang').checked = false;
        document.getElementById('dangdang1').checked = false;
        document.getElementById('dangdang2').checked = false;
        sum();
    }
}
function xuan1(xuan){
    if(document.getElementById(xuan).checked){
        document.getElementById('dangdang1').checked = true;
        document.getElementById('dangdang2').checked = true;
        sum();
    }else{
        document.getElementById('quanxuan1').checked = false;
        document.getElementById('quanxuan2').checked = false;
        document.getElementById('dangdang').checked = false;
        document.getElementById('dangdang1').checked = false;
        document.getElementById('dangdang2').checked = false;
        sum();
    }
}
